package com.huabo.contract.oracle.mapper;

import com.hbfk.util.PageInfo;
import com.huabo.contract.oracle.entity.TblContractSpnode;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author huabo
 * @since 2022-03-22
 */
public interface TblContractSpnodeMapper extends BaseMapper<TblContractSpnode> {

    @UpdateProvider(type = TblContractSpnodeMapperSqlConfig.class,method = "updateBySpnode")
    void updateBySpnode(TblContractSpnode spNode);

    @InsertProvider(type = TblContractSpnodeMapperSqlConfig.class,method = "saveBySpnode")
    void saveBySpnode(TblContractSpnode spNode);

    @SelectProvider(type = TblContractSpnodeMapperSqlConfig.class,method = "findListByXdf")
    List<TblContractSpnode> findListByXdf(PageInfo<TblContractSpnode> pageInfo, String budgetid);

    @SelectProvider(type = TblContractSpnodeMapperSqlConfig.class,method = "findListByXdfCount")
    Integer findListByXdfCount(String budgetid);

    @Select("SELECT * FROM TBL_CONTRACT_SPNODE WHERE ISWY='是' AND NODEPOST IS NOT NULL AND CONTRACTID IN (SELECT CONTRACTID FROM TBL_CYHW_UNIT WHERE CONTRACTXDFXINFO=#{budgetid})")
    List<TblContractSpnode> listBySql(Integer budgetid);
}
